<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2018/6/22 0022
 * Time: 13:53
 */

namespace app\admin\controller;


use app\model\model\Authmenu;
use think\Request;

class Auth extends Base
{
    protected $_menuModel;

    public function __construct(Request $request = null){
        parent::__construct($request);
        $this->_menuModel = new Authmenu();
    }

    /**
     * 角色列表
     * */
    public function menu_list(){

       $list = $this->_menuModel->where(['parent_id'=>0])->select();

       $this->assign('list',$list);
       return $this->fetch();
    }

    public function add_menu(){
        $parent_id = input('parent_id', 0);
        $name = input('name', '');
        $url = input('url', '');
        $type = input('type', '');
        $this->_menuModel->insert([
            'parent_id' => $parent_id,
            'name'      => $name,
            'url'       => $url,
            'type'      => $type,
            'create_time'=>time()
        ]);
    }

}